Create a custom CSS file to use the Lightning Design System in Visualforce.

To use the Design System in Visualforce you have two options:

  1. Add <apex:slds /> to your page and wrap your code in a container <div class="slds-scope"> ... </div>.
    See this code in context on Trailhead and learn more in our Visualforce Developer Guide.
  2. Or (not recommended…): create a CSS file with a custom scoped outer wrapper. A tool to create your custom CSS is available here.

If you want to dive straight in, here are a few things to note when working with the Lightning Design System in Visualforce:

  • When using the component sample code from this site, be sure to replace all static resource paths with the Visualforce URLFOR syntax, as summarized in the FAQ.
  • Apex tags such as <apex:pageblock> and <apex:inputField> are not yet supported for use with the Lightning Design System. The Trailhead unit on Visualforce development within Lightning explains options for styling legacy code to look like the new Lightning UI. For best results with the Lightning Design System, use the markup style as outlined in the component examples, and use JavaScript Remoting, Remote Objects or a similar API for data access.
  • To use the SVG spritemap icons, add the attributes xmlns="" xmlns:xlink="" to the <html> element as documented in the Trailhead module. Do not add the attributes to individual <svg> elements as can cause a page rendering bug.
  • To use SVG spritemap image icons with Internet Explorer, use the svg4everybody script.
  • Currently, if you need to use the Salesforce header or sidebar, you can not specify the xmlns="" xmlns:xlink="" on the <html> element. In this case, the SVG icons are not supported.

Details on all the above, as well as introductions to many of the Lightning Design System components, are documented in the Trailhead module.

Finally, we’d love to hear your feedback. Please share your thoughts about any aspect of the Lightning Design System via our GitHub issues.